# -*- coding: utf-8 -*-
import requests, json


# 消息内容,url地址
def dingtalk(msg, webhook):
    headers = {'Content-Type': 'application/json; charset=utf-8'}
    data = {'msgtype': 'text', 'text': {'content': msg}, 'at': {'atMobiles': [], 'isAtAll': False}}
    post_data = json.dumps(data)
    response = requests.post(webhook, headers=headers, data=post_data)
    return response.text


webhook = 'https://oapi.dingtalk.com/robot/send?access_token=c65c871054ec33d2753dbaa51e6cdfce8971baf9b56a0292d3aa8792c9a218ec'
dingtalk("老嘚~老嘚~", webhook)
